
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  
  <title>vue开发步骤 | cymiao</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="vue开发步骤(开发套路) 项目目录介绍项目总体结构图  这里我们主要需要注意的是src这个文件夹,打包之前所有的资源,pages里面放置我们需要编辑/添加的模块. 简单模块创建一个简单的模块包括:html模板,模块入口js,组件化的vue组件文件.例如下面的index模块,就是一个标准的简单模块  index.html 12345678910111213&amp;lt;!DOCTYPE html&amp;gt;">
<meta name="keywords" content="taFaceNex,vue">
<meta property="og:type" content="article">
<meta property="og:title" content="vue开发步骤">
<meta property="og:url" content="https://cyshigehaohaizi.gitee.io/2018/07/24/vue项目/vue开发步骤/index.html">
<meta property="og:site_name" content="cymiao">
<meta property="og:description" content="vue开发步骤(开发套路) 项目目录介绍项目总体结构图  这里我们主要需要注意的是src这个文件夹,打包之前所有的资源,pages里面放置我们需要编辑/添加的模块. 简单模块创建一个简单的模块包括:html模板,模块入口js,组件化的vue组件文件.例如下面的index模块,就是一个标准的简单模块  index.html 12345678910111213&amp;lt;!DOCTYPE html&amp;gt;">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://cyshigehaohaizi.gitee.io/cy_home/2018/07/24/vue项目/vue开发步骤/1.png">
<meta property="og:image" content="https://cyshigehaohaizi.gitee.io/cy_home/2018/07/24/vue项目/vue开发步骤/2.png">
<meta property="og:image" content="https://cyshigehaohaizi.gitee.io/cy_home/2018/07/24/vue项目/vue开发步骤/3.png">
<meta property="og:image" content="https://cyshigehaohaizi.gitee.io/cy_home/2018/07/24/vue项目/vue开发步骤/5.png">
<meta property="og:updated_time" content="2018-08-03T06:51:37.776Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="vue开发步骤">
<meta name="twitter:description" content="vue开发步骤(开发套路) 项目目录介绍项目总体结构图  这里我们主要需要注意的是src这个文件夹,打包之前所有的资源,pages里面放置我们需要编辑/添加的模块. 简单模块创建一个简单的模块包括:html模板,模块入口js,组件化的vue组件文件.例如下面的index模块,就是一个标准的简单模块  index.html 12345678910111213&amp;lt;!DOCTYPE html&amp;gt;">
<meta name="twitter:image" content="https://cyshigehaohaizi.gitee.io/cy_home/2018/07/24/vue项目/vue开发步骤/1.png">
  
    <link rel="alternative" href="/atom.xml" title="cymiao" type="application/atom+xml">
  
  
  <link rel="stylesheet" href="/cy_home/css/style.css">
  
    <!--<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">-->
  
  <!--[if lt IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.min.js"></script><![endif]-->
  
  

</head>

<body>
<div id="container">
  <div id="wrap">
    <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <nav id="upper-nav" class="inner">
      <a id="main-nav-toggle" class="nav-icon"></a>
      <div class="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        
          <a id="nav-github" class="nav-icon" href="https://github.com/myname"></a>
        
      </div>
    </nav>
    <div id="header-title">
      
        <h1 id="blog-title-wrap">
          <a href="/" id="blog-title">My Blog</a>
        </h1>
      
    </div>
    <div id="contenedor">
      <ul class="cube">
        <li class="cara">cy</li>
        <li class="cara">A</li>
        <li class="cara">B</li>
        <li class="cara">C</li>
        <li class="cara">D</li>
        <li class="cara">E</li>
      </ul>
    </div>
    <nav id="main-nav">
      
        <a class="main-nav-link" href="/cy_home/">Home</a>
      
        <a class="main-nav-link" href="/cy_home/archives">Archives</a>
      
        <a class="main-nav-link" href="/cy_home/about">About</a>
      
      <a class="main-nav-link st-search-show-outputs">搜索</a>
    </nav>
  </div>
</header>

    <div class="outer">
      <section id="main"><article id="post-vue项目/vue开发步骤" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <h3 href="/cy_home/2018/07/24/vue项目/vue开发步骤/" class="article-date">
  <time datetime="2018-07-24T07:59:00.000Z" itemprop="datePublished">2018-07-24</time>
</h3>
    
  </div>
  <div class="article-inner">
  <div class="curve-down">
  <div class="fill-content">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      vue开发步骤
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        
        <p>vue开发步骤(开发套路)</p>
<h3 id="项目目录介绍"><a href="#项目目录介绍" class="headerlink" title="项目目录介绍"></a>项目目录介绍</h3><p>项目总体结构图</p>
<p><img src="/cy_home/2018/07/24/vue项目/vue开发步骤/1.png" alt="图片介绍"></p>
<p>这里我们主要需要注意的是<code>src</code>这个文件夹,打包之前所有的资源,<code>pages</code>里面放置我们需要编辑/添加的模块.</p>
<h3 id="简单模块创建"><a href="#简单模块创建" class="headerlink" title="简单模块创建"></a>简单模块创建</h3><p>一个简单的模块包括:html模板,模块入口js,组件化的vue组件文件.例如下面的<code>index</code>模块,就是一个标准的简单模块</p>
<p><img src="/cy_home/2018/07/24/vue项目/vue开发步骤/2.png" alt="图片介绍"></p>
<p><strong>index.html</strong></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!DOCTYPE html&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">title</span>&gt;</span>multi_page<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">style</span> <span class="attr">type</span>=<span class="string">"text/css"</span>&gt;</span><span class="undefined"></span></span><br><span class="line"><span class="undefined">  </span><span class="tag">&lt;/<span class="name">style</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--挂载的节点app--&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><strong>index.js</strong></p>
<p>这里注意下:必须要把组件化页面挂载到html页面上.</p>
<figure class="highlight gradle"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> Vue <span class="keyword">from</span> <span class="string">'vue'</span><span class="comment">//引入vue</span></span><br><span class="line"><span class="keyword">import</span> App <span class="keyword">from</span> <span class="string">'./index.vue'</span><span class="comment">//引入组件化页面</span></span><br><span class="line"><span class="keyword">import</span> ElementUI <span class="keyword">from</span> <span class="string">'element-ui'</span>;<span class="comment">//引入框架组件</span></span><br><span class="line"><span class="keyword">import</span> <span class="string">'element-ui/lib/theme-chalk/index.css'</span>;<span class="comment">//引入框架组件样式</span></span><br><span class="line">Vue.use(ElementUI);<span class="comment">//注册框架组件</span></span><br><span class="line"><span class="comment">//把组件化页面挂载到节点app上</span></span><br><span class="line"><span class="keyword">new</span> Vue(&#123;</span><br><span class="line">  el: <span class="string">'#app'</span>,</span><br><span class="line">  template: <span class="string">'&lt;App/&gt;'</span>,</span><br><span class="line">  components: &#123; App &#125;</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<p><strong>index.vue</strong>这里的代码就不全部贴上来了</p>
<p>这个就是页面的主要功能代码,所有html内容以及js功能,样式都在这里书写,模块化很高.</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">template</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>&gt;</span></span><br><span class="line">     ......//页面内容</span><br><span class="line"></span><br><span class="line">  <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">template</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="undefined"></span></span><br><span class="line"><span class="javascript">  <span class="keyword">import</span> .....<span class="comment">//引入功能模块</span></span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="javascript">  <span class="keyword">export</span> <span class="keyword">default</span> &#123;</span></span><br><span class="line"><span class="actionscript">    name: <span class="string">'app'</span>,</span></span><br><span class="line"><span class="undefined">    data() &#123;</span></span><br><span class="line"><span class="actionscript">      <span class="keyword">return</span> &#123;</span></span><br><span class="line"><span class="actionscript">        ......<span class="comment">//初始化页面参数</span></span></span><br><span class="line"><span class="undefined">      &#125;</span></span><br><span class="line"><span class="undefined">    &#125;,</span></span><br><span class="line"><span class="actionscript">     ....<span class="comment">//页面其他功能方法</span></span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined">    &#125;</span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined">  &#125;</span></span><br><span class="line"><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">style</span> <span class="attr">lang</span>=<span class="string">"scss"</span> <span class="attr">scoped</span> <span class="attr">type</span>=<span class="string">"text/scss"</span>&gt;</span><span class="undefined"></span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined"> ....//该页面样式</span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined"></span><span class="tag">&lt;/<span class="name">style</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>这样一个简单的模块就创建好了,具体写法可以参考框架的<code>index</code>模块.</p>
<h3 id="多功能模块"><a href="#多功能模块" class="headerlink" title="多功能模块"></a>多功能模块</h3><p>多功能模块,一个模块中包括多个部分,这里需要router路由配置.</p>
<p><img src="/cy_home/2018/07/24/vue项目/vue开发步骤/3.png" alt="图片介绍"></p>
<p><strong>page1.html</strong></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!DOCTYPE html&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">title</span>&gt;</span>multi_page<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"page1"</span>&gt;</span></span><br><span class="line">  <span class="comment">&lt;!--路由显示区域--&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">router-view</span>&gt;</span><span class="tag">&lt;/<span class="name">router-view</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><strong>router/index.js</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> Vue <span class="keyword">from</span> <span class="string">'vue'</span><span class="comment">//引入vue</span></span><br><span class="line"><span class="keyword">import</span> VueRouter <span class="keyword">from</span> <span class="string">'vue-router'</span><span class="comment">//引入路由</span></span><br><span class="line"><span class="keyword">import</span> page1 <span class="keyword">from</span> <span class="string">'../page1.vue'</span><span class="comment">//引入路由页面page1</span></span><br><span class="line"><span class="keyword">import</span> part1 <span class="keyword">from</span> <span class="string">'../part/part1'</span><span class="comment">//引入路由页面part1</span></span><br><span class="line"><span class="keyword">import</span> part2 <span class="keyword">from</span> <span class="string">'../part/part2'</span><span class="comment">//欧米伽日路由页面part2</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//使用注册使用路由</span></span><br><span class="line">Vue.use(VueRouter);</span><br><span class="line"><span class="comment">//定义该模块的路由</span></span><br><span class="line"><span class="keyword">const</span> router = <span class="keyword">new</span> VueRouter(&#123;</span><br><span class="line">  routes:[</span><br><span class="line">    &#123; <span class="attr">path</span>: <span class="string">'/'</span>, <span class="attr">component</span>: page1 &#125;,</span><br><span class="line">    &#123; <span class="attr">path</span>: <span class="string">'/part1'</span>, <span class="attr">component</span>: part1 &#125;,</span><br><span class="line">    &#123; <span class="attr">path</span>: <span class="string">'/part2'</span>, <span class="attr">component</span>: part2 &#125;</span><br><span class="line">  ]</span><br><span class="line">&#125;)</span><br><span class="line"><span class="comment">//导出该模块路由</span></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> router;</span><br></pre></td></tr></table></figure>
<p><strong>page1.js</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> Vue <span class="keyword">from</span> <span class="string">'vue'</span> <span class="comment">//引入vue</span></span><br><span class="line"><span class="built_in">require</span>(<span class="string">"@/assets/css/reset.css"</span>);<span class="comment">//引入公共样式</span></span><br><span class="line"><span class="keyword">import</span> router <span class="keyword">from</span> <span class="string">'./router/index'</span> <span class="comment">//引入 改模块的路由模块</span></span><br><span class="line"><span class="keyword">import</span> ElementUI <span class="keyword">from</span> <span class="string">'element-ui'</span>;<span class="comment">//引入公共引用的组件</span></span><br><span class="line"><span class="keyword">import</span> <span class="string">'element-ui/lib/theme-chalk/index.css'</span>;<span class="comment">//引入公共引用的组件样式</span></span><br><span class="line">Vue.use(ElementUI);<span class="comment">//注册公共组件</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//引入路由,并把模块渲染到节点html节点上</span></span><br><span class="line"><span class="keyword">new</span> Vue(&#123;</span><br><span class="line">  router: router,</span><br><span class="line">&#125;).$mount(<span class="string">'#page1'</span>);</span><br></pre></td></tr></table></figure>
<p><strong>page1.vue</strong></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">template</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"page1"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">h1</span>&gt;</span>page1主页<span class="tag">&lt;/<span class="name">h1</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">cell</span>&gt;</span><span class="tag">&lt;/<span class="name">cell</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">router-link</span> <span class="attr">to</span>=<span class="string">"/part1"</span>&gt;</span>part1<span class="tag">&lt;/<span class="name">router-link</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">router-link</span> <span class="attr">to</span>=<span class="string">"/part2"</span>&gt;</span>part2<span class="tag">&lt;/<span class="name">router-link</span>&gt;</span></span><br><span class="line"></span><br><span class="line">  <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">template</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="undefined"></span></span><br><span class="line"><span class="javascript">  <span class="keyword">import</span> cell <span class="keyword">from</span> <span class="string">'components/cell.vue'</span></span></span><br><span class="line"><span class="javascript">  <span class="keyword">export</span> <span class="keyword">default</span> &#123;</span></span><br><span class="line"><span class="actionscript">    name: <span class="string">'page1'</span>,</span></span><br><span class="line"><span class="undefined">    components: &#123; cell &#125;</span></span><br><span class="line"><span class="undefined">  &#125;</span></span><br><span class="line"><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">style</span>&gt;</span><span class="undefined"></span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined"></span><span class="tag">&lt;/<span class="name">style</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><strong>part/part1.vue</strong></p>
<p>这个是第一个功能模块,通过路由链接到这个页面的</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">template</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> &gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">router-link</span> <span class="attr">to</span>=<span class="string">"/"</span>&gt;</span>回去<span class="tag">&lt;/<span class="name">router-link</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">router-link</span> <span class="attr">to</span>=<span class="string">"/part1"</span>&gt;</span>part1<span class="tag">&lt;/<span class="name">router-link</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">router-link</span> <span class="attr">to</span>=<span class="string">"/part2"</span>&gt;</span>part2<span class="tag">&lt;/<span class="name">router-link</span>&gt;</span></span><br><span class="line">  我是part1</span><br><span class="line">    </span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">template</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="undefined"></span></span><br><span class="line"><span class="javascript">  <span class="keyword">import</span> &#123;submit&#125; <span class="keyword">from</span> <span class="string">"util/form.util"</span>;</span></span><br><span class="line"><span class="javascript">  <span class="keyword">export</span> <span class="keyword">default</span> &#123;</span></span><br><span class="line"><span class="actionscript">    name:<span class="string">'part1'</span>,</span></span><br><span class="line"><span class="undefined">    data() &#123;</span></span><br><span class="line"><span class="actionscript">      <span class="keyword">return</span> &#123;</span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined">    &#125;</span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined">  &#125;</span></span><br><span class="line"><span class="undefined">&#125;</span></span><br><span class="line"><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><strong>part/part2.vue</strong></p>
<p>这个是第一个功能模块,通过路由链接到这个页面的</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">template</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span>&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">router-link</span> <span class="attr">to</span>=<span class="string">"/"</span>&gt;</span>回去<span class="tag">&lt;/<span class="name">router-link</span>&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">router-link</span> <span class="attr">to</span>=<span class="string">"/part1"</span>&gt;</span>part1<span class="tag">&lt;/<span class="name">router-link</span>&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">router-link</span> <span class="attr">to</span>=<span class="string">"/part2"</span>&gt;</span>part2<span class="tag">&lt;/<span class="name">router-link</span>&gt;</span></span><br><span class="line">        我是part2</span><br><span class="line">    <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">template</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="undefined"></span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="javascript"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span></span><br><span class="line"><span class="actionscript">  name: <span class="string">'part2'</span></span></span><br><span class="line"><span class="undefined">&#125;</span></span><br><span class="line"><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">style</span>&gt;</span><span class="undefined"></span></span><br><span class="line"><span class="undefined"></span></span><br><span class="line"><span class="undefined"></span><span class="tag">&lt;/<span class="name">style</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h3 id="添加模块功能到菜单"><a href="#添加模块功能到菜单" class="headerlink" title="添加模块功能到菜单"></a>添加模块功能到菜单</h3><p>在 银海前端开发管理平台 <code>开发管理&gt;菜单管理</code>中添加或者修改功能模块;</p>
<p><img src="/cy_home/2018/07/24/vue项目/vue开发步骤/5.png" alt="图片介绍"></p>

      
    </div>
    <footer class="article-footer">
      <div class="article-footer-content">
        
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/cy_home/tags/taFaceNex/">taFaceNex</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/cy_home/tags/vue/">vue</a></li></ul>

        <a data-url="https://cyshigehaohaizi.gitee.io/2018/07/24/vue项目/vue开发步骤/" data-id="cjnr90az70006ok76n1ss23v5" class="article-share-link">分享到</a>
        
      </div>
    </footer>
  </div>
  </div>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/cy_home/2018/07/24/vue项目/vue开发前后端交互/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">下一篇</strong>
      <div class="article-nav-title">
        
          vue开发前后端交互
        
      </div>
    </a>
  
  
    <a href="/cy_home/2018/07/24/vue项目/vue开发环境/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">上一篇</strong>
      <div class="article-nav-title">vue开发环境</div>
    </a>
  
</nav>

  
</article>


</section>
      
      <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">近期文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/cy_home/2018/10/27/npm/npm组件发布/">npm + webpack + vue 创建发布一个组件</a>
          </li>
        
          <li>
            <a href="/cy_home/2018/10/27/npm/">npm</a>
          </li>
        
          <li>
            <a href="/cy_home/2018/08/07/node/node使用记录/">node使用记录</a>
          </li>
        
          <li>
            <a href="/cy_home/2018/08/02/doclever/doclever_use/">doclever使用</a>
          </li>
        
          <li>
            <a href="/cy_home/2018/07/31/MongoDB/MongoDB/">MongoDB</a>
          </li>
        
      </ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/DOClever/">DOClever</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/MongoDB/">MongoDB</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/doclever/">doclever</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/mock/">mock</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/node/">node</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/npm/">npm</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/rap/">rap</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/taFaceNex/">taFaceNex</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/vue/">vue</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/vue-cli/">vue-cli</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/cy_home/tags/webpack/">webpack</a><span class="tag-list-count">1</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/cy_home/archives/2018/10/">十月 2018</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/cy_home/archives/2018/08/">八月 2018</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/cy_home/archives/2018/07/">七月 2018</a><span class="archive-list-count">5</span></li></ul>
    </div>
  </div>

  
</aside>
      
    </div>
    <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 cy<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
      .
      Theme by <a href="https://github.com/sun11/hexo-theme-paperbox" target="_blank">Paperbox</a>
    </div>
  </div>
</footer>
  </div>
  <nav id="mobile-nav">
  
    <a href="/cy_home/" class="mobile-nav-link">Home</a>
  
    <a href="/cy_home/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/cy_home/about" class="mobile-nav-link">About</a>
  
  <a href="#search" class="mobile-nav-link st-search-show-outputs">搜索</a>
</nav>

  

<!-- totop start -->
<div id="totop">
	<a title="返回顶部"></a>
</div>
<!-- totop end -->

<!-- swiftype search start -->

<!-- swiftype search end -->



<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/lrsjng.jquery-qrcode/0.12.0/jquery.qrcode.min.js"></script>


  <link rel="stylesheet" href="/cy_home/fancybox/jquery.fancybox.css">
  <script src="/cy_home/fancybox/jquery.fancybox.pack.js"></script>


<script src="/cy_home/js/script.js"></script>

</div>
</body>
</html>
